$OpenBSD: patch-Makefile_in,v 1.23 2013/11/28 15:25:51 stu Exp $
--- Makefile.in.orig	Tue Sep  3 13:26:17 2013
+++ Makefile.in	Wed Nov 27 23:14:02 2013
@@ -188,7 +188,7 @@ LIBOBJS1 = sqlite3.lo
 
 # Determine the real value of LIBOBJ based on the 'configure' script
 #
-LIBOBJ = $(LIBOBJS$(USE_AMALGAMATION))
+LIBOBJ = $(LIBOBJS$(USE_AMALGAMATION)) pthread_stub.lo
 
 
 # All of the source code files.
@@ -283,6 +283,8 @@ SRC = \
   $(TOP)/src/walker.c \
   $(TOP)/src/where.c
 
+SRC += $(TOP)/src/pthread_stub.c
+
 # Source code for extensions
 #
 SRC += \
@@ -491,7 +493,7 @@ EXTHDR += \
 # This is the default Makefile target.  The objects listed here
 # are what get build when you type just "make" with no arguments.
 #
-all:	sqlite3.h libsqlite3.la sqlite3$(TEXE) $(HAVE_TCL:1=libtclsqlite3.la)
+all:	$(HAVE_TCL:1=libtclsqlite3.la) lemon$(BEXE)
 
 Makefile: $(TOP)/Makefile.in
 	./config.status
@@ -503,9 +505,9 @@ libsqlite3.la:	$(LIBOBJ)
 	$(LTLINK) -o $@ $(LIBOBJ) $(TLIBS) \
 		${ALLOWRELEASE} -rpath "$(libdir)" -version-info "8:6:8"
 
-libtclsqlite3.la:	tclsqlite.lo libsqlite3.la
+libtclsqlite3.la:	tclsqlite.lo
 	$(LTLINK) -o $@ tclsqlite.lo \
-		libsqlite3.la @TCL_STUB_LIB_SPEC@ $(TLIBS) \
+		-lsqlite3 @TCL_STUB_LIB_SPEC@ $(TLIBS) \
 		-rpath "$(TCLLIBDIR)" \
 		-version-info "8:6:8" \
 		-avoid-version
@@ -793,6 +795,9 @@ tclsqlite3$(TEXE):	tclsqlite-shell.lo libsqlite3.la
 	$(LTLINK) -o $@ tclsqlite-shell.lo \
 		 libsqlite3.la $(LIBTCL)
 
+pthread_stub.lo:	$(TOP)/src/pthread_stub.c
+	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/pthread_stub.c
+
 # Rules to build opcodes.c and opcodes.h
 #
 opcodes.c:	opcodes.h $(TOP)/mkopcodec.awk
@@ -813,8 +818,12 @@ parse.c:	$(TOP)/src/parse.y lemon$(BEXE) $(TOP)/addopc
 	$(NAWK) -f $(TOP)/addopcodes.awk parse.h.temp >parse.h
 
 sqlite3.h:	$(TOP)/src/sqlite.h.in $(TOP)/manifest.uuid $(TOP)/VERSION
-	$(TCLSH_CMD) $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h
-
+	sed -e '/^#include <sqlite3\.h>$$/d' \
+	    -e 's/--VERS--/$(RELEASE)/' \
+	    -e 's/--VERSION-NUMBER--/$(VERSION_NUMBER)/' \
+	    $(TOP)/src/sqlite.h.in $(TOP)/ext/rtree/sqlite3rtree.h \
+	> sqlite3.h
+ 
 keywordhash.h:	$(TOP)/tool/mkkeywordhash.c
 	$(BCC) -o mkkeywordhash$(BEXE) $(OPT_FEATURE_FLAGS) $(OPTS) $(TOP)/tool/mkkeywordhash.c
 	./mkkeywordhash$(BEXE) >keywordhash.h
@@ -899,7 +908,7 @@ TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVAT
 TESTFIXTURE_FLAGS += -DBUILD_sqlite
 
 TESTFIXTURE_SRC0 = $(TESTSRC2) libsqlite3.la
-TESTFIXTURE_SRC1 = sqlite3.c
+TESTFIXTURE_SRC1 = sqlite3.c $(TOP)/src/pthread_stub.c
 TESTFIXTURE_SRC = $(TESTSRC) $(TOP)/src/tclsqlite.c
 TESTFIXTURE_SRC += $(TESTFIXTURE_SRC$(USE_AMALGAMATION))
 
@@ -937,18 +946,12 @@ lib_install:	libsqlite3.la
 	$(INSTALL) -d $(DESTDIR)$(libdir)
 	$(LTINSTALL) libsqlite3.la $(DESTDIR)$(libdir)
 	
-install:	sqlite3$(BEXE) lib_install sqlite3.h sqlite3.pc ${HAVE_TCL:1=tcl_install}
-	$(INSTALL) -d $(DESTDIR)$(bindir)
-	$(LTINSTALL) sqlite3$(BEXE) $(DESTDIR)$(bindir)
-	$(INSTALL) -d $(DESTDIR)$(includedir)
-	$(INSTALL) -m 0644 sqlite3.h $(DESTDIR)$(includedir)
-	$(INSTALL) -m 0644 $(TOP)/src/sqlite3ext.h $(DESTDIR)$(includedir)
-	$(INSTALL) -d $(DESTDIR)$(pkgconfigdir)
-	$(INSTALL) -m 0644 sqlite3.pc $(DESTDIR)$(pkgconfigdir)
+install:	${HAVE_TCL:1=tcl_install}
+	#
 
 pkgIndex.tcl:
 	echo 'package ifneeded sqlite3 $(RELEASE) [list load $(TCLLIBDIR)/libtclsqlite3.so sqlite3]' > $@
-tcl_install:	lib_install libtclsqlite3.la pkgIndex.tcl
+tcl_install:	libtclsqlite3.la pkgIndex.tcl
 	$(INSTALL) -d $(DESTDIR)$(TCLLIBDIR)
 	$(LTINSTALL) libtclsqlite3.la $(DESTDIR)$(TCLLIBDIR)
 	rm -f $(DESTDIR)$(TCLLIBDIR)/libtclsqlite3.la $(DESTDIR)$(TCLLIBDIR)/libtclsqlite3.a
@@ -975,6 +978,8 @@ clean:	
 
 distclean:	clean
 	rm -f config.log config.status libtool Makefile sqlite3.pc
+
+.PHONY: test
 
 #
 # Windows section
